﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 第八次作业
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void ValueBtn(object sender, EventArgs e)
        {
            textBox1.AppendText(((Button)sender).Text);
        }

        private void ClearBtn(object sender, EventArgs e)
        {
            textBox1.Text = "";
        }

        private void EqualsBtn(object sender, EventArgs e)
        {
            try
            {
                textBox1.Text = new DataTable().Compute(textBox1.Text, "").ToString();
            }
            catch
            {
                MessageBox.Show("输入错误");
            }

        }

        private void BackBtn(object sender, EventArgs e)
        {
            if (textBox1.Text.Length >= 1)
            {
                textBox1.Text = textBox1.Text.Remove(textBox1.Text.Length - 1);
            }
        }
    }
}
